import request from '@/utils/request'
import qs from 'qs'

export function page(query) {
  return request({
    url: '/api/dict/dictValue/page',
    method: 'get',
    params: query
  })
}

export function addValueObj(obj) {
  return request({
    url: '/api/dict/dictValue',
    method: 'post',
    data: obj
  })
}

export function getValueObj(id) {
  return request({
    url: '/api/dict/dictValue/' + id,
    method: 'get'
  })
}

export function delValueObj(id) {
  return request({
    url: '/api/dict/dictValue/' + id,
    method: 'delete'
  })
}

export function putValueObj(id, obj) {
  return request({
    url: '/api/dict/dictValue/' + id,
    method: 'put',
    data: obj
  })
}

export function getTypeValue(code) {
  return request({
    url: '/api/dict/dictValue/type/' + code,
    method: 'get'
  })
}

export function getUserInfoList(code) {
  return request({
    url: '/api/admin/user/getUserInfoList?' + qs.stringify(code),
    method: 'get'
  })
}

export function getCustomerList(likeQuery) {
  return request({
    url: '/api/admin/customer/queryList',
    method: 'get',
    params: likeQuery
  })
}

export function getVendorList(likeQuery) {
  return request({
    url: '/api/admin/vendor/queryList',
    method: 'get',
    params: likeQuery
  })
}

export function getProjectList(likeQuery) {
  return request({
    url: '/api/admin/project/query',
    method: 'get',
    params: likeQuery
  })
}

export function getUserList(likeQuery) {
  return request({
    url: '/api/admin/user/queryList',
    method: 'get',
    params: likeQuery
  })
}

export function getUserInfoByName(username) {
  return request({
    url: '/api/admin/user/getUserInfoByName',
    method: 'get',
    params: username
  })
}

export function saveUserInfo(obj) {
  return request({
    url: '/api/admin/user/saveUserInfo',
    method: 'post',
    data: obj
  })
}

export function inserUserInfo(obj) {
  return request({
    url: '/api/admin/user/inserUserInfo',
    method: 'post',
    data: obj
  })
}
